<?php
namespace App\Http\Resources\Mp;

use Illuminate\Http\Resources\Json\Resource;

class BookOrderResource extends Resource{

    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'status_label' => $this->status_label,
            'eat_date' => $this->rule->eat_date,
            'type_label'=>$this->rule->type_label,
            'pay_price'=>$this->pay_price,
            'is_calculated'=>$this->is_calculated,
            'status'=>$this->status,
            'is_auto'=>$this->is_auto,
            'user_id'=>$this->user_id,
            'user' => $this->whenLoaded('user'),
            'children_id'=>$this->children_id,
            'children' => $this->whenLoaded('children'),
            'created_at' => $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null
        ];
    }
}
